package de.fhdw.hbs.service;

import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;

import de.fhdw.hbs.entity.dto.BewertungDTO;
import de.fhdw.hbs.entity.dto.HotelListDTO;
import de.fhdw.hbs.entity.dto.HotelSucheDTO;
import de.fhdw.hbs.entity.dto.KundeDTO;
import de.fhdw.hbs.entity.dto.LoginDTO;
import de.fhdw.hbs.entity.dto.ReservierungDTO;
import de.fhdw.hbs.entity.dto.ReservierungListDTO;

@WebService(targetNamespace = "http://hbs.fhdw.de", name = "hbsService")
@SOAPBinding(style = SOAPBinding.Style.RPC, use = SOAPBinding.Use.LITERAL)
/**
 * Interface defining the callable web services
 * @author stephan
 *
 */
public interface HbsIF {

	// Hotelsuche
	/**
	 * Get hotel based on given criteria
	 * @param kriterien Searchcriteria
	 * @return List of Hotels as a DTO
	 * @throws HbsServiceException
	 */
	@WebMethod(operationName = "getHotelByKriterien", action = "urn:getHotelByKriterien")
	@WebResult(name = "HotelListDTO")
	public HotelListDTO getHotelByKriterien(@WebParam(name = "kriterien") HotelSucheDTO kriterien)
			throws HbsServiceException;

	// Hotelbewertung
	/**
	 * 
	 * @param hotelId
	 * @param dto BewertungDTO
	 * @throws HbsServiceException
	 */
	@WebMethod(operationName = "addHotelBewertung", action = "urn:addHotelBewertung")
	@WebResult(name = "boolean")
	public void addHotelBewertung(	@WebParam(name = "hotelId") int hotelId,
									@WebParam(name = "bewertung") BewertungDTO dto) throws HbsServiceException;

	// Reservierung
	/**
	 * 
	 * @param dto ReservierungDTO
	 */
	@WebMethod(operationName = "addReservierung", action = "urn:addReservierung")
	@WebResult(name = "boolean")
	public void addReservierung(	@WebParam(name = "reservierung") ReservierungDTO dto);

	// Reservierung
	/**
	 * 
	 * @param dto KundeDTO
	 * @return List of Reservierungen as DTO
	 */
	@WebMethod(operationName = "getReservierungByKunde", action = "urn:getReservierungByKunde")
	@WebResult(name = "Reservierung")
	public ReservierungListDTO getReservierungByKunde(	@WebParam(name = "kunde") KundeDTO dto);
	
	/**
	 * @param id Custmer id
	 * @return KundeDTO
	 * @throws HbsServiceException
	 */
	@WebMethod(operationName = "getKundeById", action = "urn:getKundeById")
	@WebResult(name = "KundeDTO")
	public KundeDTO getKundeById ( @WebParam(name = "userId") int id ) throws HbsServiceException;
	
	// Authentifizierung
	/**
	 * 
	 * @param id customer id
	 * @param pwHash Hash holding the pw
	 * @return Login information as a DTO
	 * @throws HbsServiceException
	 */
	@WebMethod(operationName = "loginById", action = "urn:loginById")
	@WebResult(name = "int")
	public LoginDTO loginById(	@WebParam(name = "userId") int id,
								@WebParam(name = "pwHash") byte[] pwHash) throws HbsServiceException;

	/**
	 * @param email Email address of customer
	 * @param pwHash Hash holding the password
	 * @return Login information as a DTO
	 * @throws HbsServiceException
	 */
	@WebMethod(operationName = "loginByEmail", action = "urn:loginByEmail")
	@WebResult(name = "int")
	public LoginDTO loginByEmail(	@WebParam(name = "email") String email,
									@WebParam(name = "pwHash") byte[] pwHash) throws HbsServiceException;

}
